disconnect layout handlers earlier in the function, to avoid possible
authorHavoc Pennington <hp@pobox.com>
Sat, 23 Mar 2002 17:35:09 +0000 (17:35 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Sat, 23 Mar 2002 17:35:09 +0000 (17:35 +0000)
2002-03-23  Havoc Pennington  <hp@pobox.com>

* gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect
layout handlers earlier in the function, to avoid possible
reentrancy screwups
(gtk_text_view_invalidate): Don't install idle handlers if
layout == NULL, otherwise we get problems during finalization
since clearing the buffer invalidates and puts the idle handlers
back after we destroy the layout. #74660
(gtk_text_view_ensure_layout): Install the validation handlers
right after creating the layout.

* gtk/gtktexttagtable.c (foreach_unref): call
_gtk_text_buffer_notify_will_remove_tag(), #75126

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktexttagtable.c
gtk/gtktextview.c

index d19050c8057dfff482121d60eb7fd79b1574b6a8..8473ad64104a4ba6df4ce6100471b93cdcda4643 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2002-03-23  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect 
+       layout handlers earlier in the function, to avoid possible
+       reentrancy screwups
+       (gtk_text_view_invalidate): Don't install idle handlers if 
+       layout == NULL, otherwise we get problems during finalization 
+       since clearing the buffer invalidates and puts the idle handlers
+       back after we destroy the layout. #74660
+       (gtk_text_view_ensure_layout): Install the validation handlers
+       right after creating the layout.
+
+       * gtk/gtktexttagtable.c (foreach_unref): call
+       _gtk_text_buffer_notify_will_remove_tag(), #75126
+
 2002-03-22  Havoc Pennington  <hp@pobox.com>
 
        * gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory
index d19050c8057dfff482121d60eb7fd79b1574b6a8..8473ad64104a4ba6df4ce6100471b93cdcda4643 100644 (file)
@@ -1,3 +1,18 @@
+2002-03-23  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect 
+       layout handlers earlier in the function, to avoid possible
+       reentrancy screwups
+       (gtk_text_view_invalidate): Don't install idle handlers if 
+       layout == NULL, otherwise we get problems during finalization 
+       since clearing the buffer invalidates and puts the idle handlers
+       back after we destroy the layout. #74660
+       (gtk_text_view_ensure_layout): Install the validation handlers
+       right after creating the layout.
+
+       * gtk/gtktexttagtable.c (foreach_unref): call
+       _gtk_text_buffer_notify_will_remove_tag(), #75126
+
 2002-03-22  Havoc Pennington  <hp@pobox.com>
 
        * gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory
index d19050c8057dfff482121d60eb7fd79b1574b6a8..8473ad64104a4ba6df4ce6100471b93cdcda4643 100644 (file)
@@ -1,3 +1,18 @@
+2002-03-23  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect 
+       layout handlers earlier in the function, to avoid possible
+       reentrancy screwups
+       (gtk_text_view_invalidate): Don't install idle handlers if 
+       layout == NULL, otherwise we get problems during finalization 
+       since clearing the buffer invalidates and puts the idle handlers
+       back after we destroy the layout. #74660
+       (gtk_text_view_ensure_layout): Install the validation handlers
+       right after creating the layout.
+
+       * gtk/gtktexttagtable.c (foreach_unref): call
+       _gtk_text_buffer_notify_will_remove_tag(), #75126
+
 2002-03-22  Havoc Pennington  <hp@pobox.com>
 
        * gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory
index d19050c8057dfff482121d60eb7fd79b1574b6a8..8473ad64104a4ba6df4ce6100471b93cdcda4643 100644 (file)
@@ -1,3 +1,18 @@
+2002-03-23  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect 
+       layout handlers earlier in the function, to avoid possible
+       reentrancy screwups
+       (gtk_text_view_invalidate): Don't install idle handlers if 
+       layout == NULL, otherwise we get problems during finalization 
+       since clearing the buffer invalidates and puts the idle handlers
+       back after we destroy the layout. #74660
+       (gtk_text_view_ensure_layout): Install the validation handlers
+       right after creating the layout.
+
+       * gtk/gtktexttagtable.c (foreach_unref): call
+       _gtk_text_buffer_notify_will_remove_tag(), #75126
+
 2002-03-22  Havoc Pennington  <hp@pobox.com>
 
        * gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory
index d19050c8057dfff482121d60eb7fd79b1574b6a8..8473ad64104a4ba6df4ce6100471b93cdcda4643 100644 (file)
@@ -1,3 +1,18 @@
+2002-03-23  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect 
+       layout handlers earlier in the function, to avoid possible
+       reentrancy screwups
+       (gtk_text_view_invalidate): Don't install idle handlers if 
+       layout == NULL, otherwise we get problems during finalization 
+       since clearing the buffer invalidates and puts the idle handlers
+       back after we destroy the layout. #74660
+       (gtk_text_view_ensure_layout): Install the validation handlers
+       right after creating the layout.
+
+       * gtk/gtktexttagtable.c (foreach_unref): call
+       _gtk_text_buffer_notify_will_remove_tag(), #75126
+
 2002-03-22  Havoc Pennington  <hp@pobox.com>
 
        * gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory
index d19050c8057dfff482121d60eb7fd79b1574b6a8..8473ad64104a4ba6df4ce6100471b93cdcda4643 100644 (file)
@@ -1,3 +1,18 @@
+2002-03-23  Havoc Pennington  <hp@pobox.com>
+
+       * gtk/gtktextview.c (gtk_text_view_destroy_layout): disconnect 
+       layout handlers earlier in the function, to avoid possible
+       reentrancy screwups
+       (gtk_text_view_invalidate): Don't install idle handlers if 
+       layout == NULL, otherwise we get problems during finalization 
+       since clearing the buffer invalidates and puts the idle handlers
+       back after we destroy the layout. #74660
+       (gtk_text_view_ensure_layout): Install the validation handlers
+       right after creating the layout.
+
+       * gtk/gtktexttagtable.c (foreach_unref): call
+       _gtk_text_buffer_notify_will_remove_tag(), #75126
+
 2002-03-22  Havoc Pennington  <hp@pobox.com>
 
        * gdk/x11/gdkfont-x11.c (gdk_fontset_load): add more explanatory
index 70c690092d41caf210ff9f9658328eda74334342..993f5d1b342d5a271f7752e3697123e3e26eb7ef 100644 (file)
@@ -135,10 +135,21 @@ gtk_text_tag_table_new (void)
 static void
 foreach_unref (GtkTextTag *tag, gpointer data)
 {
+  GSList *tmp;
+  
   /* We don't want to emit the remove signal here; so we just unparent
    * and unref the tag.
    */
 
+  tmp = tag->table->buffers;
+  while (tmp != NULL)
+    {
+      _gtk_text_buffer_notify_will_remove_tag (GTK_TEXT_BUFFER (tmp->data),
+                                               tag);
+      
+      tmp = tmp->next;
+    }
+  
   tag->table = NULL;
   g_object_unref (G_OBJECT (tag));
 }
index 230cc83318a23d3bc74eaf0261138a888fd7aa36..31c58109a2191c604345a828f1f75b6ae932b0f1 100644 (file)
@@ -2431,7 +2431,7 @@ gtk_text_view_finalize (GObject *object)
     text_window_free (text_view->bottom_window);
 
   g_object_unref (G_OBJECT (text_view->im_context));
-
+  
   (* G_OBJECT_CLASS (parent_class)->finalize) (object);
 }
 
@@ -3091,6 +3091,10 @@ gtk_text_view_invalidate (GtkTextView *text_view)
                text_view->onscreen_validated));
 
   text_view->onscreen_validated = FALSE;
+
+  /* We'll invalidate when the layout is created */
+  if (text_view->layout == NULL)
+    return;
   
   if (!text_view->first_validate_idle)
     {
@@ -5261,6 +5265,8 @@ gtk_text_view_ensure_layout (GtkTextView *text_view)
 
           tmp_list = g_slist_next (tmp_list);
         }
+
+      gtk_text_view_invalidate (text_view);
     }
 }
 
@@ -5297,6 +5303,13 @@ gtk_text_view_destroy_layout (GtkTextView *text_view)
       GSList *tmp_list;
 
       gtk_text_view_remove_validate_idles (text_view);
+
+      g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
+                                            (gpointer) invalidated_handler,
+                                           text_view);
+      g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
+                                            (gpointer) changed_handler, 
+                                           text_view);
       
       /* Remove layout from all anchored children */
       tmp_list = text_view->children;
@@ -5316,12 +5329,6 @@ gtk_text_view_destroy_layout (GtkTextView *text_view)
       gtk_text_view_stop_cursor_blink (text_view);
       gtk_text_view_end_selection_drag (text_view, NULL);
 
-      g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
-                                            (gpointer) invalidated_handler,
-                                           text_view);
-      g_signal_handlers_disconnect_by_func (G_OBJECT (text_view->layout),
-                                            (gpointer) changed_handler, 
-                                           text_view);
       g_object_unref (G_OBJECT (text_view->layout));
       text_view->layout = NULL;
     }